feat: add raw JSON recovery actions - #29
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 04f4559f2a
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| test('raw JSON save failure offers reset and reload recovery actions', async ({ | ||
| page, | ||
| }) => { |
There was a problem hiding this comment.
Mark shared route tests as serial
Because playwright.config.ts enables fullyParallel: true, adding this second test lets the two tests in this file run in separate workers while each worker's file-level setup/teardown still calls deleteAllRoutes. When those workers overlap, this test's setup or teardown can delete the route the other test is currently editing (or vice versa), so the suite becomes flaky outside the single-worker command used in the commit; mark this file/describe as serial or avoid global route cleanup for these shared-resource tests.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Pull request overview
This PR improves the Raw JSON editor recovery flow in the APISIX Dashboard by adding explicit “Reset draft” and “Reload latest” actions when a raw PATCH save fails, and extends E2E coverage to validate those recovery controls on the Routes detail page.
Changes:
- Added “Reset draft” and “Reload latest” actions to the Raw JSON editor error state.
- Refactored reset behavior into a shared callback and expanded it to clear error/feedback state.
- Added an E2E spec that simulates a raw PATCH failure and verifies the recovery actions appear and that “Reload latest” refreshes editor content.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/components/page/AdminApiJsonEditor.tsx | Adds recovery actions and refactors reset/reload handlers in the Raw JSON editor UI. |
| e2e/tests/routes.edit-payload-preservation.spec.ts | Adds E2E coverage to ensure recovery actions are available after a failed raw save and “Reload latest” updates the editor. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| setSaveFeedback({ | ||
| type: 'success', | ||
| message: 'Reloaded latest APISIX resource state.', | ||
| at: new Date().toLocaleTimeString(), | ||
| }); |
| <Button | ||
| size="small" | ||
| onClick={() => { | ||
| userEditedRef.current = false; | ||
| setValue(original); | ||
| }} | ||
| onClick={handleResetDraft} | ||
| disabled={!isDirty} | ||
| > |
Summary
Verification